package javaBase.nowcoder.HJ36_A_字符串加密;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3?tpId=37&rp=1&ru=%2Fexam%2Foj%2Fta&qru=%2Fexam%2Foj%2Fta&sourceUrl=%2Fexam%2Foj%2Fta%3FjudgeStatus%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=1&tags=&title=&gioEnter=menu
 */
public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String key = br.readLine();
        String encryption = br.readLine();
        br.close();
        String words = "abcdefghijklmnopqrstuvwxyz";
        String encryption_words = "abcdefghijklmnopqrstuvwxyz";
        String key_filter = "";
        for (int i = 0; i < key.length(); i++) {
            if (key_filter.indexOf(key.charAt(i)) == -1) {
                key_filter += key.charAt(i);
                words = words.replace(key.charAt(i) + "", "");
            }
        }
        words = key_filter + words;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < encryption.length(); i++) {
            int index = encryption_words.indexOf(encryption.charAt(i));
            sb.append(words.charAt(index));

        }
        System.out.println(sb.toString());


    }
}
